package com.by.toolkit.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

@Getter
@AllArgsConstructor
public enum LiveTypeEnum {

    LIVE(1, "直播"),
    REPLAY(2, "回放"),
    ;

    private Integer code;
    private String desc;

    private static final Map<Integer, LiveTypeEnum> MAP = Arrays.stream(LiveTypeEnum.values())
            .collect(Collectors.toMap(LiveTypeEnum::getCode, Function.identity()));

    public static LiveTypeEnum resolve(Integer code) {
        return MAP.get(code);
    }

    public static final int LIVE_CODE = 1;
    public static final int REPLAY_CODE = 2;

}
